#pragma once

#include "2d/CCActionInterval.h"



class MoveByCircle : public cocos2d::ActionInterval
{
public:
        typedef std::function<cocos2d::Vec2(void)> CenterUpdater;
        void dumy();
        static MoveByCircle* create(float duration, cocos2d::Vec2 center, 
                bool needUpdateCenter = false, CenterUpdater updater = nullptr);

        void startWithTarget(cocos2d::Node *target) override;
        void update(float dt) override;

CC_CONSTRUCTOR_ACCESS:
        MoveByCircle();
        ~MoveByCircle();

        bool initWithDuration(float duration, cocos2d::Vec2 center);


private:
        DISALLOW_COPY_AND_ASSIGN(MoveByCircle);
        cocos2d::Vec2   _center;
        cocos2d::Vec2   _startPosition;
        float           _radius;
        float           _originRadian;
        bool            _needUpdateCenter;
        CenterUpdater   _centerUpdater;
};

